package com.puti.doctor.controller;

import com.puti.common.core.web.controller.BaseController;
import com.puti.common.core.web.domain.AjaxResult;
import com.puti.common.core.web.page.TableDataInfo;
import com.puti.doctor.domian.HospitalDoctorInfo;
import com.puti.doctor.service.HospitalDoctorInfoService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("/doctor")
public class HospitalDoctorInfoController extends BaseController {

    @Autowired
    private HospitalDoctorInfoService hospitalDoctorInfoService;

    //审核管理-待审核列表
    @GetMapping("/selectHospitalDoctorInfoList")
    public TableDataInfo selectHospitalDoctorInfoList(HospitalDoctorInfo hospitalDoctorInfo){
        startPage();
        List<HospitalDoctorInfo> hospitalDoctorInfos = hospitalDoctorInfoService.selectHospitalDoctorInfoList(hospitalDoctorInfo);
        return getDataTable(hospitalDoctorInfos);
    }

    //审核管理-审核列表-审核、通过、不通过        根据doctorId进行数据回显
    @GetMapping("/selectHospitalDoctorInfoByDoctorId")
    public AjaxResult selectHospitalDoctorInfoByDoctorId(Integer doctorId){
        return AjaxResult.success(hospitalDoctorInfoService.selectHospitalDoctorInfoByDoctorId(doctorId));
    }

    //审核管理-审核通过
    @PutMapping("updateHospitalDoctorInfoDoctorApproved")
    public AjaxResult updateHospitalDoctorInfoDoctorApproved(@RequestBody HospitalDoctorInfo hospitalDoctorInfo){
        return toAjax(hospitalDoctorInfoService.updateHospitalDoctorInfoDoctorNotApproved(hospitalDoctorInfo));
    }

    //审核管理-审核不通过
    @PutMapping("/updateHospitalDoctorInfoDoctorNotApproved")
    public AjaxResult updateHospitalDoctorInfoDoctorNotApproved(@RequestBody HospitalDoctorInfo hospitalDoctorInfo){
        return toAjax(hospitalDoctorInfoService.updateHospitalDoctorInfoDoctorNotApproved(hospitalDoctorInfo));
    }

    //审核管理-审核通过列表
    @GetMapping("/selectApprovedList")
    public TableDataInfo selectApprovedList(HospitalDoctorInfo hospitalDoctorInfo){
        startPage();
        List<HospitalDoctorInfo> approvedList = hospitalDoctorInfoService.selectApprovedList(hospitalDoctorInfo);
        return getDataTable(approvedList);
    }

    //审核管理-审核不通过列表
    @GetMapping("/selectNotApprovedList")
    public TableDataInfo selectNotApprovedList(HospitalDoctorInfo hospitalDoctorInfo){
        startPage();
        List<HospitalDoctorInfo> notApprovedList = hospitalDoctorInfoService.selectNotApprovedList(hospitalDoctorInfo);
        return getDataTable(notApprovedList);
    }

}